import request from '../utils/request'
let apiUrl = '/userFunction'

// 获取用户全部数据
export function getUserMsgData(data) {
    return request({
        method: 'post',
        url: apiUrl + '/getUserMsg',
        data
    })
}


// 订阅数据
export function subscription(data) {
    return request({
        method: 'post',
        url: apiUrl + '/subscription',
        data
    })
}


// 订阅书籍
export function payBook(data) {
    return request({
        method: 'post',
        url: apiUrl + '/payBook',
        data
    })
}
// 充值金额
export function payMoney(data) {
    return request({
        method: 'post',
        url: apiUrl + '/payMoney',
        data
    })
}
// 关注用户
export function contact(data) {
    return request({
        method: 'post',
        url: apiUrl + '/contact',
        data
    })
}

// 取关用户
export function delContact(data) {
    return request({
        method: 'post',
        url: apiUrl + '/delContact',
        data
    })
}

export function getAuthor(data) {
    return request({
        method: 'post',
        url: apiUrl + '/authorMsg',
        data
    })
}

// 添加评论
export function addEvaluation(data) {
    return request({
        method: 'post',
        url: apiUrl + '/addEvaluation',
        data
    })
}


// 获取图书评论
export function getEvaluation(data) {
    return request({
        method: 'post',
        url: apiUrl + '/getEvaluation',
        data
    })
}

// 图书点赞
export function addGood(data) {
    return request({
        method: 'post',
        url: apiUrl + '/addGood',
        data
    })
}

// 图书删除评论
export function delEvaluation(data) {
    return request({
        method: 'post',
        url: apiUrl + '/delEvaluation',
        data
    })
}

// 评论点赞
export function setGood(data) {
    return request({
        method: 'post',
        url: apiUrl + '/setGood',
        data
    })
}
// 获取评论点赞
export function getGood(data) {
    return request({
        method: 'post',
        url: apiUrl + '/getGood',
        data
    })
}
//收藏音频
export function getCollect(data) {
    return request({
        method: 'post',
        url: apiUrl + '/collect',
        data
    })
}

//历史记录
export function gethistory(data) {
    return request({
        method: 'post',
        url: apiUrl + '/viewing',
        data
    })
}


// 下载文件
export function downloads(url) {
    return request({
        method: 'get',
        url: '/static' + url,
        responseType: 'arraybuffer'
    })
}

//下载记录
export function download(data){
        return request({
            method:'post',
            url:apiUrl + '/download',
            data
        })
}